package com.tan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tan.entity.PageResult;
import com.tan.mapper.GoodsMapper;
import com.tan.pojo.Brand;
import com.tan.pojo.Goods;
import com.tan.service.IGoodsService;
import com.tan.vo.GoodsQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tanMax
 * @since 2022-09-30
 */
@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements IGoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public PageResult search(Integer currentPage, Integer pageSize, GoodsQueryVo vo) {
        IPage<Goods> page = new Page<>(currentPage,pageSize);
        IPage pages = goodsMapper.selectAll(page);
        return new PageResult(pages.getTotal(),pages.getRecords());
    }
}
